default:
  image: registry.denistv777.ru/docker:24.0.5
  services:
    - name: docker:24.0.5-dind
variables:
  DOCKER_TLS_CERTDIR: "/certs"
  DOCKER_BUILDKIT: "1"
stages:
  - build

build:
  stage: build
  variables:
    IMAGE: "registry.denistv777.ru/open/myheat-prometheus-exporter"
  script:
    - docker pull $IMAGE:latest || true
    - >
      docker build
      --cache-from $IMAGE:latest
      --label "image.revision=$CI_COMMIT_SHA"
      --tag $IMAGE:$CI_COMMIT_SHA
      --target=app -f Dockerfile
      .
    - docker push $IMAGE:$CI_COMMIT_SHA
